import request from '@/utils/request'

export function login(username, password) {
  // const _data = new FormData()
  // _data.append('username', username)
  // _data.append('password', password)
  return request({
    url: '/login',
    method: 'post',
    data: {
      'username': username,
      'password': password
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function getUserMenuTree(token) {
  return request({
    url: '/system/resources/findResourcesEMUByResources',
    method: 'get',
    params: { token }
  })
}

export function updatePwd(params) {
  return request({
    url: '/system/user/toUpdatePassword',
    method: 'post',
    data: params
  })
}

export function findOldPwd(token) {
  return request({
    url: '/system/user/toUpdatePassword',
    method: 'get',
    params: token
  })
}
